<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var books=['三国演义','水浒传','恶作剧之吻']
        // for(let i in books){
        //     console.log(i);
        // }//0,1,2
        // var person ={
        //     name:'董卓',
        //     age:18,
        //     sex:'男'
        // }
      
        // for(let key of person){
        //     console.log(key);
        // }  
        // for(let key in person){
        //     console.log(key);
        //     console.log(person[key]);
        // }  //name 董卓 age 18 sex 男

    // var arr =[12,13,14,15,16]
    // console.log(arr.keys());
    // for(let key of arr){
    //     console.log(key);
    // }
    var m1 = new Map()  //定义map

    //给map里面添加元素 ,每个元素由key和value组成
    m1.set('001',{id:'001',name:'董卓',age:18})
    m1.set('002',{id:'002',name:'杨幂',age:28})
    m1.set('003',{id:'003',name:'加拿大克里斯',age:11})
    for(let item of m1){
        console.log(item);
    }
    console.log("============================");//分割线
    for(let key of m1.keys()){
        console.log(key);
    }
    console.log("============================");//分割线
    for(let value of m1.values()){
        console.log(value);
    }
    console.log("============================");//分割线
    for(var name of m1.entries()){
            console.log(name);        
        }
    </script>
</body>
</html>